<template>
    <el-row :gutter="0">
        <el-col :span="4">
            <h1>
                <HomeFilled class="svg"></HomeFilled>
                / 医院详情
            </h1>
            <el-menu :default-active="defaultPath" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
                >
                <el-menu-item index="/hospital/registered" @click="changeActive('/hospital/registered')">
                    <el-icon>
                        <ChatLineRound />
                    </el-icon>
                    <span>预约挂号</span>
                </el-menu-item>
                <el-menu-item index="/hospital/detail" @click="changeActive('/hospital/detail')">
                    <el-icon>
                        <location />
                    </el-icon>
                    <span>医院详情</span>
                </el-menu-item>
                <el-menu-item index="/hospital/notice" @click="changeActive('/hospital/notice')">
                    <el-icon>
                        <document />
                    </el-icon>
                    <span>预约通知</span>
                </el-menu-item>
                <el-menu-item index="/hospital/inform" @click="changeActive('/hospital/inform')">
                    <el-icon>
                        <setting />
                    </el-icon>
                    <span>停诊信息</span>
                </el-menu-item>
                <el-menu-item index="/hospital/opera" @click="changeActive('/hospital/opera')">
                    <el-icon>
                        <setting />
                    </el-icon>
                    <span>查询/取消</span>
                </el-menu-item>
            </el-menu>
        </el-col>

        <el-col :span="20">
            <router-view></router-view>
        </el-col>
    </el-row>
</template>
<script setup lang="ts">
import { useRoute, useRouter } from 'vue-router';
import { nextTick, onMounted,ref,onUnmounted } from 'vue';
// 引入仓库
import { useDetailStore } from '@/stores/modules/hosDetail'
let detailStore = useDetailStore()

let $route = useRoute();
let $router = useRouter();
// 获取当前路由的路径
let defaultPath = $route.path;
// 获取当前路由的query获取数据

let hoscode =$route.query.hosCode 

const changeActive = (path: string) => {
  //跳转到对应二级路由
    $router.push({
        path,
        query: {hosCode:hoscode}
    })
};

const getDate = async () => {

}
onMounted(async () => {
    await detailStore.getDetail(( hoscode as string))

    await detailStore.getDep((hoscode as string))
})


const handleOpen = async (key: string, keyPath: string[]) => {

}
const handleClose = (key: string, keyPath: string[]) => {

}
</script>

<style scoped lang="scss">
h1 {
    margin-bottom: 15px;
    margin-left: 30px;
    color: #ccc;

    .svg {
        width: 15px;
        height: 15px;
    }
}
</style>